<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            border:1px solid #ccc;
            position: absolute;
            left:0;
            right:0;
            margin:20px auto;
        }
    </style>
</head>
<body>
    <canvas id="box" width="800" height="450"></canvas>
</body>
<script>
    //获取canvas
    const boxDom=document.querySelector('#box')
    //生成canvas对象 相当于echarts中的echarts.init(boxDom)
    const context=boxDom.getContext('2d')

    //开始绘制
    context.beginPath();
    
    context.strokeStyle='#f00';
    

    context.moveTo(87,184);
    context.lineTo(340, 74);
    context.lineTo(551, 202);
    context.lineTo(572, 73);

    //封闭路径
    context.closePath();
    

    //执行画线命令
    context.stroke();

    //第二条折线
     //开始绘制
    context.beginPath();
    
    context.strokeStyle='#00f';
    context.moveTo(88, 310);
    context.lineTo(263, 272);
    context.stroke();

    //绘制点
    context.beginPath();
    context.lineWidth=2;
    
    context.moveTo(103, 64);
    context.lineTo(104, 65);
    context.stroke();
    
    
    
    


    
</script>
</html>